Add tests for URLSession._MultiHandle
Windows issue
#4854
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds test cases for #4791.
Test HTTPServer needs to be reconfigured (we need synchronous processing and minimal listening socket backlog) for one of the test scenarios, so there are options now.
test_httpTimeout
- formertest_timeoutInterval
, is adjusted to actually test for timeout (it was falsely detecting connection error as expected result)test_connectTimeout
- tests a specific scenario, when the socket is timing out on connection attempt. Seems like with recent cURL library update this now works same way as http timeout, but in the past there was difference, so it is good thing to testtest_repeatedRequestsStress
- included only in Windows suite, does a heavy pressure on URLSession/Dispatch using small packs of simultaneous requests, repeated lot of times. There are a bit of randomness, but I find 3000 cycles enough to reproduce crash on my machine. In most of cases it fails on first 300-500 cycles.macOS system Foundation runs these tests perfectly (btw did we lose Darwin Compatibility Tests target?), but for SwiftFoundation on macOS the
test_repeatedRequestsStress
is surprisingly way slower (I'd say x10 slower) than even on Windows. Anyway, this particular test is intended only for testing against socket reuse on Windows.